/*************************************************************************************************************
						  Copyright (C), 2006-2022, Autostar Tech. Co., Ltd.		
                         -----------------------------------------------
* 	FileName:       DrvWdt.c
* 	Description:	Here Descript the file main function 

* 	Author:         Yelinshan
* 	UpdateDate:     2022/5/18
* 	Version:        0.1.0 
    History:			

*************************************************************************************************************/

/*************************************************************************************************************
										 	Include Files
*************************************************************************************************************/
#include "DrvCpu.h"
/*************************************************************************************************************
										 	Local Function
*************************************************************************************************************/

/*************************************************************************************************************
                                         	Extern Function
*************************************************************************************************************/

/*************************************************************************************************************
										 	Macro
*************************************************************************************************************/

/*************************************************************************************************************
										 	Enumerate
*************************************************************************************************************/

/*************************************************************************************************************
										 	Structure
*************************************************************************************************************/

/*************************************************************************************************************
										 	Static Varable
*************************************************************************************************************/

/*************************************************************************************************************
										 	Constant
*************************************************************************************************************/

/*************************************************************************************************************
* Function Name  : DrvCpuInit
* Description    : System Init
* Input          : None
* Output         : None
* Return         : None
* Modifies       : NONE
*************************************************************************************************************/
void DrvCpuInit(void)
{
    RCC_OscInitTypeDef RCC_OscInitStruct = {0};
    RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI \
                                    | RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;  /* Configure HSE, HSI, LSI, LSE */
    RCC_OscInitStruct.HSIState = RCC_HSI_ON;                                             /* Enable HSI */
    RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;                                             /* HSI not divided */
    RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_24MHz;                    /* HSI calibration frequency 16MHz */
    RCC_OscInitStruct.HSEState = RCC_HSE_OFF;                                            /* Disable HSE */
    /* RCC_OscInitStruct.HSEFreq = RCC_HSE_16_32MHz; */                                  /* HSE frequency range: 16~32MHz */
    RCC_OscInitStruct.LSIState = RCC_LSI_ON;                                             /* Enable LSI */
    RCC_OscInitStruct.LSEState = RCC_LSE_OFF;                                            /* Disable LSE */
    /* RCC_OscInitStruct.LSEDriver = RCC_LSEDRIVE_MEDIUM; */                             /* Default LSE drive capability */
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;                                         /* Enable PLL */
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;                                 /* Select HSI as PLL source */
    /* Configure oscillators */
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    {
        APP_ErrorHandler();
    }

    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1;/* Configure SYSCLK, HCLK, PCLK */
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;                                     /* Configure system clock as PLL */
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;                                            /* AHBNo clock division */
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;                                             /* APBNo clock division */
    /* Configure clock source */
    if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
    {
        APP_ErrorHandler();
    }
}

/*************************************************************************************************************
* Function Name  : DelayTimeUs
* Description    : System delay us
* Input          : None
* Output         : None
* Return         : None
* Modifies       : NONE
*************************************************************************************************************/
void DelayTimeUs(uint16_t uwDelayCnt)
{
	
}

/*************************************************************************************************************
* Function Name  : DelayTimeMs
* Description    : System delay Ms
* Input          : None
* Output         : None
* Return         : None
* Modifies       : NONE
*************************************************************************************************************/
void DelayTimeMs(uint16_t uwDelayCnt)
{
	
}

